<%-- 
    Document   : index
    Created on : 24-jun-2013, 20:06:58
    Author     : juli
--%>

<%@page import="beans.Dao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="CSS/style.css"/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Index</title>
    </head>
    <body id="css-meeting-planner">
        <div class="page-wrapper">
            <section class="intro"> 
                <div class="preamble" id="mp-resources">
                    <p><h1>Welcome ${sessionScope['sessionNombre']}</h1></p>
         <%
           HttpSession respuesta = request.getSession(true);
           String email=respuesta.getAttribute("sessionEmail").toString();
           Dao d= new Dao();
           d.conectar();
           //El usuario es manager y organizer
           if(d.isEmailMRegistered(email) && d.isEmailORegistered(email)){
               out.print("<p><a href='register.jsp'>Register a new user</a></p>");
               out.print("<p><a href='createroom.jsp'>Create a new Room</a></p>");
               out.print("<p><a href='modifroom.jsp'>Modify a Room</a></p>");
               out.print("<p><a href='createInvitation.jsp'>Create a Invitation</a></p>");
               out.print("<p><a href='seeResponses.jsp'>See invitation's responses</a></p>");
           }else{
           //Es organizer
           if(d.isEmailORegistered(email)){ 
                out.print("<p><a href='createInvitation.jsp'>Create a Invitation</a></p>");
                out.print("<p><a href='seeResponses.jsp'>See invitation's responses</a></p>");
           }
           //Es manager
           if(d.isEmailMRegistered(email)){
               out.print("<p><a href='register.jsp'>Register a new user</a></p>");
               out.print("<p><a href='createroom.jsp'>Create a new Room</a></p>");
               out.print("<p><a href='modifroom.jsp'>Modify a Room</a></p>");
           }
           }
           d.desconectar();
           %>
         <form action="Logout" method="Post">
              <input type="submit" value="Salir" onclick="logout.jsp;">
        </form>
                </div>
            </section>
        </div>
    </body>
</html>
